package structural.composite;

import java.util.ArrayList;

public class CompositeElement extends DrawingElement {

	private ArrayList<DrawingElement> _elements = new ArrayList<DrawingElement>();
	public CompositeElement(String name) {
		super(name);
	}

	@Override
	public void add(DrawingElement d) {
		_elements.add(d);
	}

	@Override
	public void display(int indent) {
		System.out.println(new String(new String("----------").toCharArray(), 0, indent)+ " " + _name);
		for(DrawingElement d : _elements)
			d.display(indent + 2);
	}

	@Override
	public void remove(DrawingElement d) {
		_elements.remove(d);
	}

}
